package com.wfm.tmp;

import org.junit.Test;

public class p647回文个数 {
    int countSubstrings(String s){
        int num=0;
        int n = s.length();
        for (int i = 0; i < n; i++) {
            for (int j = 0; j <= 1; j++) {
                int l = i;
                int r = i+j;
                while (l>=0&&r<n) {
                    if(s.charAt(l)==s.charAt(r)){
                        num++;
                        System.out.println(s.substring(l,r+1));
                        --l;
                        ++r;
                    }else break;
                }
            }
        }
        return num;
    }
    @Test
    public void test(){
        System.out.println(countSubstrings("ABBAB"));
    }
}
